package com.sky.controller.user;

import com.sky.constant.MessageConstant;
import com.sky.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController("userShopController")
@Slf4j
@Api(tags = "用户端查询 店铺营业状态 ")
@RequestMapping("/user/shop")
public class ShopController {

    @Autowired
    RedisTemplate redisTemplate;
    public static final String KEY = "SHOP_STATUS";
    @ApiOperation(value = "用户端 查询营业状态")
    @GetMapping("/status")
    public Result<Integer> getshopstatus(){

        log.info("查询店铺状态");
        ValueOperations valueOperations = redisTemplate.opsForValue();
        Integer status = (Integer) valueOperations.get(KEY);

        return Result.success(status);
    }
}
